from app.model.user import User


class UserAuth:
    @staticmethod
    def check(user_id, password):
        user = User.query.filter(User.User_id == user_id).first()
        if user.User_id == user_id and user.User_pwd == password:
            return user.User_identity
        return -1

    @staticmethod
    def get_user_type_by_id(user_id):
        user = User.query.filter(User.User_id == user_id).first()
        if user is None:
            return -1
        return user.User_identity
